public class Demo2 {

    public static void main(String[] args) throws InterruptedException {


        Thread t = new Thread(() ->  {
            for (int i = 0; i < 3; i++) {
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

//        System.out.println(t.getState());
        t.start();
        System.out.println(t.getState());
     t.interrupt();
        System.out.println(t.isInterrupted());
      Thread.sleep(1000);
       System.out.println(t.getState());
        System.out.println(Thread.currentThread().getState());

        //t.join(30000);
    }
}
